#include "junix.h"
#include <tr1/unordered_set>
#include <boost/functional/hash.hpp>

using namespace std;

struct point
{
    int x;
    int y;
};

bool operator==(point const& p1, point const& p2)
{
    return p1.x == p2.x && p1.y == p2.y;
}

struct point_hash
    : std::unary_function<point, std::size_t>
{
    std::size_t operator()(point const& p) const
    {
        std::size_t seed = 0;
        boost::hash_combine(seed, p.x);
        boost::hash_combine(seed, p.y);
        return seed;
    }
};


int main()
{
	std::tr1::unordered_multiset<point, point_hash> points;

	point pa = {1,2};
	point pb = {1,2};

	assert( pa==pb);

	points.insert(pa);
	points.insert(pb);
	points.insert(pb);
	points.insert(pb);
	points.insert(pb);
	points.insert(pb);

	std::cout<<points.size()<<std::endl;

	BOOST_FOREACH(const point& p, points)
	{
		std::cout<<"("<<p.x<<","<<p.y<<")"<<std::endl;
	}

	return 0;
}
